<div class="row">
    <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
        <div class="widget am-cf">
            <div class="widget-head am-cf">
                <div class="widget-title am-cf">代理商申请列表</div>
                <!-- 工具栏 -->
                <div class="am-scrollable-horizontal am-u-sm-12">
                    <table width="100%" class="am-table am-table-compact am-table-striped tpl-table-black ">
                        <thead>
                        <tr>
                            <th>订单id</th>
                            <th>品牌商审核状态</th>
                            <th>总后台审核状态</th>
                            <th>品牌商审核时间</th>
                            <th>总后台审核时间</th>
                            <th>提现申请时间</th>
                            <th>开票状态</th>
                            <th>提现金额</th>
                            <th>代理名称</th>
                            <th>代理级别</th>
                            <th>总后台拒绝原因</th>
                            <th>操作</th>

                        </tr>
                        </thead>
                        <tbody>
                        <?php if(!$list->isEmpty()):foreach($list as $item):?>
                            <tr>
                                <td class="am-text-middle">
                                    <p class="item-title"><?= $item['id'] ?></p>
                                </td>
                                <td class="am-text-middle">
                                    <p class="item-title"><?php if($item['pps_status']==0){ echo '待审核';}elseif($item['pps_status']==1){ echo '已通过';}
                                        else{ echo '待解冻';}?></p>
                                </td>
                                <td class="am-text-middle">
                                    <p class="item-title"><?php if($item['sh_status']==0){ echo '待审核';}elseif($item['sh_status']==1){ echo '已通过';}
                                        else{ echo '已拒绝';}?></p>
                                </td>
                                <td class="am-text-middle"><?php if($item['pps_update_time']==0){ echo '待审核';}else{  echo format_time($item['pps_update_time']);}?></td>
                                <td class="am-text-middle"><?php if($item['sh_update_time']==0){ echo '待审核';}else{ echo format_time($item['sh_update_time']);}?></td>

                                <td class="am-text-middle"><?= $item['create_time'] ?></td>

                                <td class="am-text-middle">
                                    <p class="item-title"><?php if($item['isKaipiao']==0){ echo '不开票';}else{ echo '开票';}?></p>
                                </td>

                                <td class="am-text-middle">
                                    <p class="item-title"><?= $item['money'] ?></p>
                                </td>
                                <td class="am-text-middle">
                                    <p class="item-title"><?= $item['real_name'] ?></p>
                                </td>


                                <td class="am-text-middle">
                                    <p class="item-title"><?php if($item['type']==0){ echo '品牌商';}elseif($item['type']==1){ echo '城市运营商';}
                                        else{ echo '城市合伙人';}?></p>
                                </td>


                                <td class="am-text-middle">
                                    <p class="item-title"><?php if($item['remark']==0){ echo '无';}
                                        else{ echo $item['remark'];}?></p>
                                </td>
                                <td class="am-text-middle">
                                    <?php if ($item['pps_status']==0){ ?>
                                        <div class="tpl-table-black-operation">
                                            <a onclick="getInformation('<?= $item['id'] ?>','1')" class="j-delete tpl-table-black-operation-del"
                                               data-id="<?= $item['agent_id'] ?>">
                                                <i class="am-icon-trash"></i>通过
                                            </a>
                                            <a onclick="getInformation('<?= $item['id'] ?>','2')" class="j-delete tpl-table-black-operation-del"
                                               data-id="<?= $item['agent_id'] ?>">
                                                <i class="am-icon-trash"></i>冻结
                                            </a>
                                        </div>
                                    <?php }; ?>

                                    <?php if ($item['pps_status']==1&&$item['sh_status']==0){ ?>
                                        <div class="tpl-table-black-operation">
                                            <a  class="j-delete tpl-table-black-operation-del"
                                               data-id="<?= $item['agent_id'] ?>">
                                                <i class="am-icon-trash"></i>待总后台审核
                                            </a>
                                        </div>
                                    <?php }; ?>

                                    <?php if ($item['pps_status']==1&&$item['sh_status']==1){ ?>
                                        <div class="tpl-table-black-operation">
                                            <a  class="j-delete tpl-table-black-operation-default"
                                                data-id="<?= $item['agent_id'] ?>">
                                                <i class="am-icon-trash"></i>已成功
                                            </a>
                                        </div>
                                    <?php }; ?>


                                    <?php if ($item['pps_status']==1&&$item['sh_status']==2){ ?>
                                        <div class="tpl-table-black-operation">
                                            <a  class="j-delete tpl-table-black-operation-del"
                                                data-id="<?= $item['agent_id'] ?>">
                                                <i class="am-icon-trash"></i>总后台已拒绝
                                            </a>
                                        </div>
                                    <?php }; ?>

                                    <?php if ($item['pps_status']==2){ ?>
                                        <div class="tpl-table-black-operation">
                                            <a  class="j-delete tpl-table-black-operation-del"
                                                data-id="<?= $item['agent_id'] ?>">
                                                <i class="am-icon-trash"></i>待总后台解冻
                                            </a>
                                        </div>
                                    <?php }; ?>
                                    <?php if ($item['sh_status']==2){ ?>
                                        <div class="tpl-table-black-operation">
                                            <a  class="j-delete tpl-table-black-operation-del"
                                                data-id="<?= $item['agent_id'] ?>">
                                                <i class="am-icon-trash"></i>提现失败
                                            </a>
                                        </div>
                                    <?php }; ?>
                                </td>
                            </tr>
                        <?php endforeach; else: ?>
                            <tr>
                                <td colspan="4" class="am-text-center">暂无记录</td>
                            </tr>
                        <?php endif; ?>
                        </tbody>
                    </table>
                </div>
                <div class="am-u-lg-12 am-cf">
                    <div class="am-fr"><?= $list->render() ?> </div>
                    <div class="am-fr pagination-total am-margin-right">
                        <div class="am-vertical-align-middle">总记录：<?= $list->total() ?></div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    function getInformation(id,status){
        $.ajax({
            url:"index.php?s=/agent/cash.agentcash/check",
            dataType:"json",
            async:true,
            data:{"status":status,"id":id},
            type:"post",
            success:function(req){
                layer.msg(req.msg);
                window.location.href='index.php?s=/agent/cash.agentcash/indexagent'
            },
            error:function(){

            }
        });
    }


</script>
